import { Module } from '@nestjs/common';
import { AdminService } from './admin.service';
import { AdminController } from './admin.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Admin } from './admin.entity';
import { ConfigService } from '@nestjs/config';
import { ConfigEnum } from 'src/enum/config.enum';
import { JwtModule } from '@nestjs/jwt';
import { JwtStrategy } from './admin.strategy';

@Module({
  imports: [TypeOrmModule.forFeature([Admin]),JwtModule.registerAsync({
    useFactory:async (configService:ConfigService) => ({
      secret:configService.get<string>(ConfigEnum.SECRET),
      signOptions: {
        expiresIn: '7d',
      }
    }),
    inject:[ConfigService]
  })],
  controllers: [AdminController],
  providers: [AdminService,JwtStrategy]
})
export class AdminModule {}
